From: tsteven4 Date: Wed, 13 Mar 2019 17:13:07 +0000 (-0600) Subject: fix stackfilter issues. (#324) X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~8^2~20 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22Program/%22http:/www.example.com/cgi/%22https:/%22Program?a=commitdiff_plain;h=7070659a99c216afd1e9a64cc3de24b8967c76a5;p=gpsbabel.git fix stackfilter issues. (#324) 1. correct defect in the new RouteList::swap method. 2. correct an old bug in stackfilter that cleaned up waypts on exit, but not routes or tracks. 3. enhance stackfilter test to test routes and tracks as well as waypts. --- diff --git a/route.cc b/route.cc index c3b5742ab..81b7ff398 100644 --- a/route.cc +++ b/route.cc @@ -521,8 +521,8 @@ RouteList::restore(RouteList* src) void RouteList::swap(RouteList& other) { const RouteList tmp_list = *this; - other = *this; - *this = tmp_list; + *this = other; + other = tmp_list; } void RouteList::sort(Compare cmp) diff --git a/stackfilter.cc b/stackfilter.cc index c50f5445d..3721ab25a 100644 --- a/stackfilter.cc +++ b/stackfilter.cc @@ -166,6 +166,8 @@ void StackFilter::exit() } while (stack) { waypt_flush(&(stack->waypts)); + stack->routes.flush(); + stack->tracks.flush(); tmp_elt = stack; stack = stack->next; delete tmp_elt; diff --git a/testo.d/stackfilter.test b/testo.d/stackfilter.test index bc25122c9..25ab1b89b 100644 --- a/testo.d/stackfilter.test +++ b/testo.d/stackfilter.test @@ -7,3 +7,7 @@ gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -x stack,push,copy,nowarn -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -o arc -F ${TMPDIR}/stackfilt.txt +gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -x transform,rte=wpt,del -x stack,push,copy,nowarn -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -o arc -F ${TMPDIR}/stackfilt.txt + +gpsbabel -i geo -f ${REFERENCE}/../geocaching.loc -x transform,trk=wpt,del -x stack,push,copy,nowarn -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -o arc -F ${TMPDIR}/stackfilt.txt +